package monsmon.run;

import monsmon.util.*;
import monsmon.util.getopt.*;
/*
 * holds main method and some startup stuff
 *
 */
public class Init{

	private static final String args = "fms:d:c:";
	private static final LongOpt[] lopts = {
		new LongOpt("fullscreen", LongOpt.NO_ARG, 'f'),
		new LongOpt("maximize", LongOpt.NO_ARG, 'm'),
		new LongOpt("screen-size", LongOpt.REQ_ARG, 's'),
		new LongOpt("data-dir", LongOpt.REQ_ARG, 'd'),
		new LongOpt("config-dir", LongOpt.REQ_ARG, 'c')
	};

	private static void parse_opts(String argv[]){
		Getopt g = new Getopt(argv, args, lopts);
		int c = 0;
		while((c = g.getopt()) != -1){
			switch(c){
				case '?':
					System.out.println("unknown arg: " +
						g.get_optarg());
					break;
				case 'f':
					System.out.println("using fscreen");
					break;
				case 'm':
					System.out.println("Maximize");
					break;
				case 'd':
					System.out.println("Data dir: " +
						g.get_optarg());
					break;
				case 'c':
					System.out.println("Config dir: " +
						g.get_optarg());
					break;
			}
		}
	}

	public static void main(String args[]){
		FileLocator.add_all_read_dirs("../dat", "dat");
		ConfigParser.parse_config(FileLocator.get_read_file(
					"monstermon.cfg"));
		parse_opts(args);
		MainLoop.init_game();
	}
	
}
